<template>
  <view>
    <pageheader :setting="settingdata"></pageheader>
    <view class="detail_info">
      <view class="detail_title">{{detail.title}}</view>
      <view class="theNews_info">
        <text>{{detail.views}}人浏览</text>
        <text class="info_time">{{detail.createtime}}</text>
      </view>
    </view>
    <view class="contents">
		<block v-if="detail.content.length>0">
			<u-parse :html="content"></u-parse>
		</block>
		<block v-else>
			{{detail.desc}}
			<image :src="item" mode="widthFix" v-for="(item,index) in detail.images"></image>
		</block>
    </view>
  </view>
</template>

<script>
  var _this;
  export default {
    data() {
      return {
        settingdata: {
          name: '公告详情',
          bgColor: '#fff',
          titleColor: '#000000',
          showNav: true,
          showTypes: 0,
          position: "newdetail"
        },
		detail:{}
      }
    },
    onLoad(options) {
      _this = this
	  _this.id=options.id
	  _this.getdata()
    },
    methods: {
		// 获取数据
		getdata() {
			_this.$api.get("noticedetail", {id:_this.id}).then(data => {
				_this.detail=data
			});
		},
    }
  }
</script>

<style lang="scss" scoped>
  .detail_info {
    padding: 47rpx 7rpx 40rpx 7rpx;
    margin: 0 25rpx;
    border-bottom: 2rpx solid #e6e6e6;
    display: flex;
    flex-direction: column;

    .detail_title {
      color: #333333;
      font-size: 36rpx;
    }

    .theNews_info {
      margin-top: 28rpx;
      display: flex;
      flex-direction: row;
      align-items: center;

      text {
        color: #A8A8A8;
        font-size: 24rpx;
      }

      .info_time {
        margin-left: 48rpx;
      }
    }
  }
  
  .contents{
    margin: 40rpx 33rpx;
	image{
		max-width: 100%;
	}
  }
</style>
